﻿using System.Collections.Generic;
using System.Linq;
using System.Web.Http;
using AutoMapper;
using CNav.Business.Services;
using CNav.Common;
using CNav.Domain;
using CNav.Model;
using Microsoft.Practices.Unity;

namespace CNav.DataApi.DataApi
{
    public class UserProfileController : BaseApiController
    {
        [Authorize, HttpGet]
        public IList<UserProfileModel> BusinessUsers(int id)
        {
            var userList = Service.Get<IBusinessAccountService>().GetUserProfilesDetails(false);
            userList.ValidateAndThrow();

            IList<UserProfileModel> userProfileModels = userList.Data.Select(Mapper.Map<UserProfileModel>).ToList();
            return userProfileModels;
        }
    }
}